// import { resetRouter } from '@/router'
import request from '@/utils/request'

// 获取所有角色列表
export const getRoles = (params) => {
  return request({
    url: '/sys/role',
    method: 'GET',
    params
  })
}

// 获取公司信息
export const getCompanyInfo = (id) => {
  return request({
    url: `/company/${id}`,
    method: 'GET'
  })
}

// 添加角色API
export const addRole = (data) => {
  return request({
    url: '/sys/role',
    method: 'POST',
    data
  })
}

// 获取角色详情API
export const getRoleById = (id) => {
  return request({
    url: '/sys/role/' + id,
    method: 'GET'
  })
}

// 编辑角色详情API
export const updataRole = (data) => {
  return request({
    url: '/sys/role/' + data.id,
    method: 'PUT',
    data
  })
}

// 删除角色API
export const delRole = (id) => {
  return request({
    url: '/sys/role/' + id,
    method: 'DELETE'
  })
}

// 给角色分配权限
export const assignPrem = (data) => {
  return request({
    url: '/sys/role/assignPrem',
    method: 'PUT',
    data
  })
}

